<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
		div{
			border: black 1px solid;
			position: relative;
		}
		#d1{
			width: 250px;
			height: 250px;
		}
		#d2{
			width: 200px;
			height: 200px;
			left: 25px;
			top: 25px;
		}
		#d3{
			width: 150px;
			height: 150px;
			left: 25px;
			top: 25px;
		}
		#d4{
			width: 100px;
			height: 100px;
			left: 25px;
			top: 25px;
		}
		#d5{
			width: 50px;
			height: 50px;
			left: 25px;
			top: 25px;
		}
		</style>
	</head>
	<body>
		<div id="d1">
			<div id="d2">
				<div id="d3">
					<div id="d4">
						<div id="d5"></div>
					</div>
				</div>
			</div>
		</div>
		
		<script type="text/javascript">
			var divs=document.getElementsByTagName("div");
			for (let i = 0; i < divs.length; i++) {
				divs[i].onmouseover=function(){
					event.currentTarget.setAttribute("style","background-color: gray;");
				}
				divs[i].onmouseout=function(){
					event.currentTarget.setAttribute("style","background-color: white;");
				}
			}
		</script>
		
		
	</body>
</html>
